# Maintainer: Alexander F Rødseth <xyproto@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - fix flags for ARM architectures
#  - change from being an 'any' package to architecture-specific

pkgname=shedskin
pkgver=0.9.4
pkgrel=3
pkgdesc='Python to C++ compiler'
arch=('arm' 'armv6h' 'armv7h' 'aarch64')
url='https://shedskin.github.io/'
license=('GPL2')
depends=('pcre' 'gc' 'python2')
makedepends=('git')
source=("git+https://github.com/shedskin/shedskin.git#tag=v$pkgver")
sha256sums=('SKIP')

prepare() {
  [[ $CARCH == "arm" ]] && sed -i 's/-march=native/-march=armv5te/' $pkgname/shedskin/FLAGS
  [[ $CARCH == "armv6h" ]] && sed -i 's/-march=native/-march=armv6 -mfloat-abi=hard -mfpu=vfp/' $pkgname/shedskin/FLAGS
  [[ $CARCH == "armv7h" ]] && sed -i 's/-march=native/-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard/' $pkgname/shedskin/FLAGS
  [[ $CARCH == "aarch64" ]] && sed -i 's/-march=native/-march=armv8-a/' $pkgname/shedskin/FLAGS
  sed -i 's:bin/python:usr/bin/python:' "$pkgname/scripts/$pkgname"
}

package() {
  cd "$pkgname"

  python2 setup.py install --prefix="$pkgdir/usr"
}

# vim: ts=2 sw=2 et:
